package mapper;

import com.yh.javabean.Student;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.SelectKey;

/**
 * @Auther: Liang
 * @Date: 2024/5/9 - 05 - 09 - 14:42
 * @Description: mapper
 * @version: 1.0
 */
public interface StudentMapper {
    //通过@SelectKey注解 实现UUID生成主键
    @Insert("insert into student (sid,sname,sage) values(#{sid},#{sname},#{sage})")
    @SelectKey(statement = " select replace(UUID(),'-','') as uid from dual",
            keyProperty = "sid",keyColumn = "kid",before = true,resultType = String.class)

    int insertStudent(Student student);
}